#!/bin/bash
# 导入函数与变量
source <(curl -sL "https://raw.gitcode.com/Xrkseek/sunflower-yunzai-scripts/raw/master/shell_modules/color.sh")
source <(curl -sL "https://raw.gitcode.com/Xrkseek/sunflower-yunzai-scripts/raw/master/shell_modules/Yunzai_pieces.sh")
source <(curl -sL "https://raw.gitcode.com/Xrkseek/sunflower-yunzai-scripts/raw/master/shell_modules/install.sh")
确定系统安装器魔法

# 统一日志输出风格（不改动原有安装逻辑）
log_info()    { echo -e "${color_light_blue}[信息] $1${reset_color}"; }
log_success() { echo -e "${color_light_green}[成功] $1${reset_color}"; }
log_error()   { echo -e "${color_red}[错误] $1${reset_color}"; }

# 检查是否为 Arch Linux 系统
if [ ! -f /etc/arch-release ]; then
    log_error "此脚本仅适用于 Arch Linux 系统"
    exit 1
else
    log_success "检测到系统为 Arch Linux"
fi

# 更新系统
log_info "正在更新系统软件包..."
if pacman -Syu --noconfirm; then
    log_success "系统更新完成"
else
    log_error "系统更新失败，请重新运行脚本"
    exit 1
fi

bash <(curl -sL https://raw.gitcode.com/Xrkseek/sunflower-yunzai-scripts/raw/master/Yunzai-install/software/yq)
# 安装基本工具
for package in git wget tar xz jq go-yq sudo nodejs-lts-iron npm redis wqy-bitmapfont wqy-zenhei ttf-arphic-ukai ttf-arphic-uming; do
    install_package "$package"
done

# 安装脚本
安装xrk脚本

# 删除云崽（如果存在）
检测云崽存在魔法

# 下载 Node 和 npm
检测npm-node-pnpm安装

# 检查和安装 Chromium
if ! command -v chromium &>/dev/null; then
    log_info "开始安装 Chromium，请耐心等待..."
    if pacman -S --noconfirm chromium; then
        log_success "Chromium 安装成功"
    else
        log_error "Chromium 安装失败"
        exit 1
    fi
else
    log_success "检测到 Chromium 已安装，跳过安装"
fi

# 启动 Redis
检测redis安装

# 提供安装选项
云崽安装菜单